﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;

namespace FishSimulation.Model {
    public class ModelBase : INotifyPropertyChanged {        
        string _Id;
                
        [Browsable(false)]
        public string Id {
            get {
                return _Id;
            }
            set {
                if (_Id != value) {
                    _Id = value;
                    this.OnPropertyChanged("Id");
                }
            }
        }

        [Browsable(false)]
        public bool IsDirty {
            get;
            set;
        }

        public ModelBase() {
            
        }

        static ModelBase() {            
            string img = Utils.ImagePath;
            if(!System.IO.Directory.Exists(img)){
                System.IO.Directory.CreateDirectory(img);
            }
        }             

        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged(string name) {
            if (this.PropertyChanged != null) {
                this.IsDirty = true;
                this.PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }        
    }
}
